package com.example.demo.service;

import com.example.demo.mapper.AccountMapper;
import com.example.demo.model.Account;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ling
 * Date: 2023-12-13
 * Time: 10:06
 */
@Service
public class AccountService {
    @Autowired
    AccountMapper accountMapper;

    public int create(Integer number,Integer money,String password,Integer userId) {
        return accountMapper.create(number,money,password,userId);
    }

    public Account selectAccountByNumber(Integer number) {
        return accountMapper.selectAccountByNumber(number);
    }

    public List<Account> selectAll(Integer userId) {
        return accountMapper.selectAccountByUserId(userId);
    }

    public int reduceMoney(Integer number,Integer money) {
        return accountMapper.reduceMoney(number,money);
    }

    public int addMoney(Integer number,Integer money) {
        return accountMapper.addMoney(number,money);
    }
}
